package com.itheima.chapter12.classLoader;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ClassLoaderDemo2 {
    public static void main(String[] args) throws IOException {
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        System.out.println(systemClassLoader);
        /*
        通过系统类加载器加载配置文件
        系统类加载器加载我们自己写的类 src文件夹
         */
        InputStream is = systemClassLoader.getResourceAsStream("config.properties");
        Properties prop = new Properties();
        prop.load(is);
        is.close();
        String username = prop.getProperty("username");
        String password = prop.getProperty("password");
        System.out.println(username);
        System.out.println(password);
    }
}
